{extend name="./template/default/m/pub/base.html" /}
{block name="seo"}
<title>{$book.book_name}全集免费高清无修在线阅读-{$site_name}</title>
<meta name="description" content="{$book.book_name}又名{$book.nick_name}，是一本地区为{$book.area.area_name}，类型为{$book.tags}的高人气漫画，漫画简介：{$book.summary}">
{/block}
{block name="css"}
<link rel="stylesheet" href="/static/css/jquery-ui-1.7.3.custom.css">
{/block}
{block name="content"}

{include file="./template/default/m/pub/top2.html" /}
<div class="detail-main">
    <img class="detail-main-bg" data-original="{$book.cover_url}" src="https://p.pstatp.com/origin/ffa400036691f82c85e5">
    <div class="detail-main-cover">
        <img class="lazy" data-original="{$book.cover_url}" src="https://p.pstatp.com/origin/ffa400036691f82c85e5">
    </div>
    <div class="detail-main-info">
        <p class="detail-main-info-title">{$book.book_name}</p>
        <p class="detail-main-info-author">别名：
            <a href="#">{$book.nick_name}</a>
        </p>
        <p class="detail-main-info-author">作者：
            <a href="#">{$book.author.author_name|substr=10}...</a>
        </p>
        <p class="detail-main-info-author">地区：
            <a href="/{$booklist_act}/?area={$book.area_id}">{$book.area.area_name}</a>
        </p>
        <p class="detail-main-info-class">
            {volist name="tags" id="vo"}
            <span>
                <a href="/{$booklist_act}/?tag={$vo}">{$vo}</a>
            </span>
            {/volist}
        </p>
    </div>
</div>
<p class="detail-desc">{$book.summary}</p>
<div id="tempc">
    <div class="detail-selector item-3">
        <a class="detail-selector-item active" href="javascript:void(0);"
           onclick="titleSelect(this, '#chapter_indexes');">目录</a>
        <a class="detail-selector-item" href="javascript:void(0);"
           onclick="titleSelect(this, '#comment');">评论
            <span class="detail-selector-item-count commentcount">999+</span>
        </a>
        <a class="detail-selector-item" href="javascript:void(0);"
           onclick="titleSelect(this, '#recommand');">推荐</a>

    </div>
    <div id="chapter_indexes" class="selector-zero">
        <div class="detail-list-title" id="detail-list-title">
            <span class="detail-list-title-1">{$book.end==0?'连载中':'已完结'}</span>
            <span class="detail-list-title-3">{$book.last_time|date='Y-m-d'}更新</span>
            <a href="javascript:void(0);" mode="0" onclick="sortBtnClick(this);" class="detail-list-title-right inverted">倒序</a>
        </div>
        {if $book.is_copyright == 0}
        <ul class="detail-list-1 detail-list-select" id="detail-list-select">
            {raccoon:chapters name="chapters" where="book_id='$book->id'" order="chapter_order asc"}
            <li>
                <a href="/{$chapter_ctrl}/{$vo.id}" title="{$vo.chapter_name}" class="chapteritem">{$vo.chapter_name}</a>
                {if $vo.chapter_order >= $start_pay }
                <img class="detail-list-3-info-right" src="/static/images/center-main-list-logo-4.png">
                {/if}
            </li>
            {/raccoon:chapters}
        </ul>
        {/if}
        <div class="detail-fix-bottom">
            {if $xwx_user_id == null}
            <a href="javascript:void(0);" class="collection">
                <img class="detail-bottom-1" src="/static/images/detail-bottom-1.png">
            </a>
            {else /}
            {if $isfavor == 0}
            <a href="javascript:void(0);" class="collection" data-val="0" id="addfavor">
                <img class="detail-bottom-1" src="/static/images/detail-bottom-1.png">
            </a>
            {else /}
            <a href="javascript:void(0);" class="collection" data-val="1" id="addfavor">
                <img class="detail-bottom-1" src="/static/images/book-list-bottom-right-2.png">
            </a>
            {/if}
            {/if}
            <a href="javascript:void(0)" class="btndownload">
                <img class="detail-bottom-2" src="/static/images/detail-bottom-2.png">
            </a>
            {if $book.is_copyright == 1}
                <a href="{$book.src_url}" class="detail-bottom-btn">正版阅读</a>
            {else /}
                {if $start == -1}
                <a href="#" class="detail-bottom-btn">暂无章节</a>
                {else /}
                <a href="/{$chapter_ctrl}/{$start}" class="detail-bottom-btn">开始阅读</a>
                {/if}
            {/if}
        </div>
        <a class="detail-list-more" id="detail-list-more" href="javascript:void(0);" onclick="charpterMore(this);">展开全部章节</a>
        <script>
            $(document).ready(function(){
                var much = $("#detail-list-select li").length + 1;
                if (much <= 13) {
                    $('#detail-list-more').hide();
                }
            })

        </script>
    </div>

    <script>
        ;(function(){
            $("#detail-list-select li").each(function(){
                var tsi=$(this).index();
                $(this).attr("idx",tsi);
            })
        })();

        $('a.collection').click(function () {
            var val = $(this).attr('data-val');
            $.post({
                url:`/addfavor`,
                data:{'book_id' : {$book.id}, 'val' : val },
                success: function (res) {
                    if (res.err == 1){
                        ShowDialog(res.msg);
                    } else {
                        if (res.isfavor == 1){ //表示收藏了，将控件状态改为已收藏
                            $('#addfavor').attr('data-val',1);
                            $('img.detail-bottom-1').attr('src','/static/images/book-list-bottom-right-2.png')
                            ShowDialog('收藏成功');
                        } else { //更改为未收藏
                            $('#addfavor').attr('data-val',0);
                            $('img.detail-bottom-1').attr('src','/static/images/detail-bottom-1.png')
                            ShowDialog('取消收藏');
                        }
                    }
                },
            })
        })

    </script>

    <div class="win-comment" id="win-comment" style="display: none;">
        <a href="javascript:$('#win-comment').hide();" class="closecomment">
            <img class="win-comment-cross" src="/static/images/win-cross.png">
        </a>
        <p class="win-comment-title">发表评论</p>
        <textarea class="win-comment-input comment-input" id="content">

            </textarea>
        <a class="win-comment-btn" onclick="subcomment();">发表评论</a>
    </div>
    <input type="hidden" id="book_id" value="{$book.id}">
    <input type="hidden" id="session_uid" value="{$xwx_user_id|default=-1}">
    <div id="comment" style="display:none;" class="selector-zero">
        <ul class="detail-list-comment" style="display: block;">
            {raccoon:comments name="comments" where="book_id='$book->id'" order="id desc"}
            <li>
                <div class="detail-list-comment-cover">
                    <img src="/static/images/mrtx.gif">
                </div>
                <div class="detail-list-comment-info">
                    <p class="detail-list-comment-title">{$vo.user.nick_name|default=$vo.user.username}
                        <a class="detail-list-comment-right zanbtn" href="javascript:void(0);">1</a>
                    </p>
                    <p class="detail-list-comment-subtitle">{$vo.create_time|date='Y-m-d'}</p>
                    <p class="detail-list-comment-content recommentbtn" >{$vo.content|raw}</p>
                </div>
            </li>
            {/raccoon:comments}
        </ul>
        <div class="detail-comment-fix-bottom">
            <a class="detail-comment-fix-bottom-a btncomment" href="javascript:$('#win-comment').show();">
                <img class="detail-comment-fix-bottom-logo" src="/static/images/detail-comment-logo.png">我已经忍不住要吐槽啦～
            </a>
        </div>
    </div>
    <div id="recommand" style="display:none;" class="selector-zero">
        {raccoon:books name="books" where="tags like '%book->tags%' or area_id='$book->area_id'"
        order="last_time desc" limit="6"}
        <div class="buy-manga">
            <div class="buy-manga-cover">
                <a href="/{$book_ctrl}/{$vo.param}">
                    <img src="{$vo.cover_url}">
                </a>
                <a class="buy-manga-cover-hover" href="javascript:void(0);" mid="2941" style="display:none;"></a>
            </div>
            <div class="buy-manga-info">
                <a href="/{$book_ctrl}/{$vo.param}" class="readlink" mid="2941">
                    <p class="buy-manga-title">{$vo.book_name}</p>
                </a>
                <p class="buy-manga-author">{$vo.last_time|date='Y-m-d'}更新</p>
                <a href="/{$book_ctrl}/{$vo.param}" class="readlink" mid="40683">
                    <p class="buy-manga-new">{$vo.summary|subtext=12}...</p>
                </a>
                <a class="buy-manga-right-a readlink" href="/{$book_ctrl}/{$vo.param} ">
                    <img class="buy-manga-right-img" src="/static/images/buy-manga-right.png">
                    <p class="buy-manga-right-title">阅读</p>
                </a>
            </div>
        </div>
        {/raccoon:books}
    </div>
</div>
<div class="toast" style="display:none;"></div>
<div style="height:70px;"></div>
<script>
    function titleSelect(item,id) {
        $('.detail-selector-item').removeClass('active');
        $(item).addClass('active');
        $('.selector-zero').hide();
        $(id).show();
    }
</script>
<script>
    function subcomment() {
        var uid = $('#session_uid').val();
        var comment = $('#content').val();
        var book_id = $('#book_id').val();
        if (uid === '-1') {
            ShowDialog('请先登录');
        } else if (comment.length <= 0) {
            ShowDialog('请勿提交空评论');
        } else {
            $.post({
                url: '/commentadd',
                data: {comment: comment, book_id: book_id},
                success(res) {
                    if (res.err === 1) {
                        ShowDialog(res.msg);
                    } else {
                        ShowDialog(res.msg);
                        setTimeout(function () {
                            location.reload();
                        },1000)
                    }
                },
                error(res) {
                    ShowDialog('表单提交出错');
                    return false;
                }
            })
        }
    }
</script>
{include file="./template/default/m/pub/return_top.html"}

{/block}